<?php
	
class Table_Mannequin extends Zend_Db_Table_Abstract
{
    protected $_name    = 'mannequin';
    protected $_primary = 'VIP_NUMERO';
    protected $_sequence = FALSE;
 	
	public function insertMannequin($numVip, $tailleMann){
                $data = array('VIP_NUMERO'=> $numVip, 'MANNEQUIN_TAILLE' => $tailleMann);
                $this->insert($data);
    }
	
	public function getMannequinTaille($id) {
		return $this-> fetchRow($this
			->select()
			->from($this, array('mannequin_taille'))
			->where('vip_numero = ?', $id)
			);
	}
	
	public function getAllDefilesMannequin ($id) {	
    	$req=$this->select()
			->setIntegrityCheck(false)
			->from(array('m' =>'mannequin'), array('*'))
			->join(array('dd' => 'defiledans'), 'dd.vip_numero= m.vip_numero', array(''))
			->join(array('d' => 'defile'), 'dd.defile_numero = d.defile_numero', array('*'))
			->join(array('c' => 'couturier'), 'c.vip_numero = d.vip_numero', array(''))		
			->join(array('v' => 'vip'), 'v.vip_numero = c.vip_numero', array('*'))
			->where('m.vip_numero = ?', $id);
			
			$resu=$this->fetchAll($req);
			return $resu;
	}
	
	public function supprMannequin($id){
		$this->delete('VIP_NUMERO ='.(int)$id);
	}
	
	
}